package com.ebeijia.service.user.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ebeijia.mybatis.mapper.HomeSourceInfoMapper;
import com.ebeijia.mybatis.pojo.HomeSourceInfo;
import com.ebeijia.service.user.HomeService;

@Service("homeService")
public class HomeServiceImpl implements HomeService {
	/**
	 * 依赖注入mapper文件
	 */
	@Autowired
	private HomeSourceInfoMapper homeMapper;

	/***
	 * 根据userId 查询所有房源信息
	 * 
	 * @return List<Homes>
	 */
	public List<HomeSourceInfo> getUserAndHomeById(String userId) {
		
		return homeMapper.getUserAndHomeById(userId);
	}

	/**
	 * 根据房源查询个人信息 (绑定房源信息)
	 * 
	 * @param homeName
	 */
	public HomeSourceInfo getHomeUserNo(String homeUserNo,String userId) {
		Map params=new HashMap();
		params.put("userId", userId);
		params.put("hsUserNo", homeUserNo);
		return homeMapper.selectByParams(params);
	}

	/**
	 * 用户销户 param　homeUserNo
	 */
	public int destoryUser(String homeUserNo) {
		return homeMapper.deleteByUser(homeUserNo);
	}



	/**
	 * 新增房源信息
	 */
	public int insertHome(HomeSourceInfo homeInfo) {
		return homeMapper.insert(homeInfo);
	}



	/**
	 * 水量查询 調用接口
	 */
	public List<Map<String, Object>> getWaterList(Map<String, Object> params) {

		return homeMapper.getWaterList(params);
	}

	/**
	 * 消费查询 调用接口
	 */
	public List<Map<String, Object>> getBalanceList(Map<String, Object> params) {

		return homeMapper.getBalanceList(params);
	}
	/**
	 * 水厂接口 进行余额查询
	 */
	@Override
	public List<Map<String, Object>> getBanlanceFree(Map<String, Object> params) {
		
		return null;
	}



}
